import { Controller, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
import { FileInterceptor, FilesInterceptor } from '@nestjs/platform-express'
import { SysFileService } from './sysFile.service';
import type { FileType, FilesType } from './sysFile.dto'

@Controller('sys-file')
export class SysFileController {
  constructor(private readonly sysFileService: SysFileService) {
  }

  @Post('upload')
  @UseInterceptors(FileInterceptor('file'), FilesInterceptor('files'))
  upload(@UploadedFile() file: FileType, files: FilesType) {
    return this.sysFileService.upload(file ?? files)
  }

}
